package cn.iocoder.an.module.business.utils;

import lombok.Data;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

@Data
@NoArgsConstructor
public class WeComMessage {

    private String msgtype;
    private TextContent text;
    private MarkdownContent markdown;

    // 静态工厂方法：文本消息
    public static WeComMessage text(String content, String... mentionedMobiles) {
        WeComMessage msg = new WeComMessage();
        msg.msgtype = "text";
        msg.text = new TextContent(content, mentionedMobiles);
        return msg;
    }

    // 静态工厂方法：Markdown 消息
    public static WeComMessage markdown(String content) {
        WeComMessage msg = new WeComMessage();
        msg.msgtype = "markdown";
        msg.markdown = new MarkdownContent(content);
        return msg;
    }

    // 文本内容
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class TextContent {
        private String content;
        private String[] mentioned_mobile_list; // 企业微信字段名必须是下划线
    }

    // Markdown 内容
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class MarkdownContent {
        private String content;
    }
}